import React, {Component} from 'react';
import {
  View,
  Text,
  TouchableOpacity,
  StyleSheet,
  Platform,
  Picker,
} from 'react-native';

import Config from '../../config';
import Colors from '../../common/Colors';
import CommonStyles from '../../common/CommonStyles';
import SizeUtils from '../../common/SizeUtils';
import TImage from '../../components/TImage';
import WH_Constants from './WH_Constants';
import CommonListPage from '../common/CommonListPage';
import {DateUtils} from '../../utils/Utils';
import WH_PostItemView from './WH_PostItemView';
import CommonShowPickerAction from '../../actions/common/CommonShowPickerAction';
import WH_RequestHuoJiangAction from '../../actions/workhard/WH_RequestHuoJiangAction';

export default class WH_GongjiangPage extends CommonListPage {
	_getViewStyle() {
      return {paddingTop:Config.paddingTop,
        backgroundColor:"#ffffff"}
  	}
	_getListViewStyle() {
      return {
        width:SizeUtils.getWindowSize().width,
        paddingTop:0,
        height:(SizeUtils.getWindowSize().height - Config.paddingTop - SizeUtils.translateDesignHeightToCode(210)),
        backgroundColor:"#fff"};
  	}
    refRefresh(){
      this.doRefresh();
    }
  	_onRenderItem(data, index) {
    	return (<WH_PostItemView refRefresh={this.refRefresh.bind(this)} data={data} index={index} showNum = {true} />)
  	}
  	_renderTopView(){
  		const { titleStr } =this.props.pageData.routeData;
    	return(
      		<View style={{height:SizeUtils.translateDesignHeightToCode(88),
      			alignItems: 'flex-start',justifyContent: 'center',
      			backgroundColor:'#eee'}}>
				<Text style={[CommonStyles.secondaryText,
              		{marginLeft:SizeUtils.translateDesignHeightToCode(26),textAlign:"center", fontSize:SizeUtils.translateFontSizeToCode(30), backgroundColor:"#00000000", borderWidth:0,}]}>{titleStr}
           		 </Text>
      		</View>
    	);
  	}
 	 _requestData(page, listView) {
 	 	const { tip,year,month,tip_type } =this.props.pageData.routeData;
 	 	new WH_RequestHuoJiangAction().call(listView, {tip:tip,tip_type:tip_type,
       		page:page, page_size:10,month:month,year:year});
	}
}